//
//  ViewController.m
//  3dtest
//
//  Created by XL on 2022/7/21.
//

#import "ViewController.h"
@import GLTFSceneKit;
@import SceneKit;
#import "CardScrollView.h"
#import "Masonry.h"


@interface ViewController ()

@property (nonatomic , nonnull , strong) NSArray<NSString *> * cardSource;

@end

@implementation ViewController

- (NSArray<NSString *> *)cardSource{
    if (_cardSource == nil) {
        _cardSource = @[
                        [[NSBundle mainBundle] pathForResource:@"黑卡.gltf" ofType:nil],
                        [[NSBundle mainBundle] pathForResource:@"蓝卡.gltf" ofType:nil],
                        [[NSBundle mainBundle] pathForResource:@"紫卡.gltf" ofType:nil]];
    }
    return _cardSource;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    
    CardScrollView * sv = [[CardScrollView alloc] initWithSource:self.cardSource];
    [self.view addSubview:sv];
    [sv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@(20));
        make.left.right.equalTo(self.view);
        make.height.equalTo(@([CardItemView cardHeight]));
    }];
    sv.changePageBlock = ^(int page) {
        NSLog(@"当前页：%d",page);
    };
}


@end
